package com.english_test_sys.service.Impl;

import com.english_test_sys.mapper.QuestionMapper;
import com.english_test_sys.pojo.Question;
import com.english_test_sys.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public List<Question> getQuestionsByCategoryAndType(String category, String type) {
        return questionMapper.getQuestionsByCategoryAndType(category, type);
    }

    @Override
    public List<Question> getQuestionsByDifficulty(Integer difficulty) {
        return questionMapper.getQuestionsByDifficulty(difficulty);
    }


    @Override
    public void importQuestion(Question question) {
        questionMapper.importQuestion(question);
    }

    @Override
    public Question getQuestionById(Integer id) {
        return questionMapper.selectById(id); // 调用Mapper
    }
    @Override
    public void updateQuestion(Question question) {
        questionMapper.updateQuestion(question);
    }

    @Override
    public void deleteQuestion(Integer id) {
        questionMapper.deleteQuestion(id);
    }
}
